import {
    showMsg
  } from "../../utils/config";
  import {
    validateMobile,
  } from '../../utils/validate.js';
  var app = getApp()
  Page({
    data: {
      navHeight: app.globalData.navHeight + 'px', //头部距离
      phone: '',
    },
    clearPhone() {
      this.setData({
        phone: ''
      })
    },
    inputPhone(e) {
      this.setData({
        phone: e.detail
      })
    },
    async onNextPage() {
      if (!this.data.phone) return showMsg('请输入手机号')
      if (this.data.phone == wx.getStorageSync('mobile')) return showMsg('新手机号不能与当前账号相同')
      if (!validateMobile(this.data.phone)) return
      wx.showModal({
        title: '确认手机号',
        content: `我们将发送短信验证码到这个号码:+86 ${this.data.phone}`,
        complete: (res) => {
          if (res.confirm) {
            wx.navigateTo({
              url: `/pages/codeVerify/codeVerify?type=2&&phone=${this.data.phone}`,
            })
          }
        }
      })
    }
  })